package main

import (
	"fmt"
	"time"
)

func main() {
	mainChan := make(chan int)

	receivers := 3
	for i := 0; i < receivers; i++ {
		go func(i int) {
			for {
				msg := <-mainChan
				fmt.Printf("receiver %d received: %v\n", i, msg)
			}
		}(i)
	}
	for i := 0; ; i++ {
		mainChan <- i
		time.Sleep(time.Second)
	}
}
